package com.fxpc.hddc.death.jpa.dao.pg;


import com.fxpc.hddc.death.dto.pg.entity.FxCasualtyLevelMapPgEntity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface FxCasualtyLevelMapPgBaseDao extends JpaRepository<FxCasualtyLevelMapPgEntity, String> {

    @Query(nativeQuery = true, value = "select * from fx_casualty_level_map WHERE CAST(create_time AS  DATE)= DATE(:nowDay) AND is_valid='1' AND extend10= :extend10")
    List<FxCasualtyLevelMapPgEntity> findPgOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay,@Param(value = "extend10")String extend10);

    @Query(nativeQuery = true, value = "select * from fx_casualty_level_map WHERE is_valid='1' AND extend10= :extend10 ")
    List<FxCasualtyLevelMapPgEntity> findAllTime(@Param(value = "extend10")String extend10);

    Long count(Specification<FxCasualtyLevelMapPgEntity> specification);
}
